package com.example.smart_campus.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.example.smart_campus.pojo.dto.grades.GradesTable;
import com.example.smart_campus.pojo.dto.students.StudentsTable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serializable;

/**
 * <p>
 * 成绩表，存储学生的成绩信息
 * </p>
 *
 * @author liyv
 * @since 2024-10-19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("grades")
public class Grades implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 成绩ID，主键
     */
    @TableId(value = "grade_id", type = IdType.AUTO)
    private Integer gradeId;

    /**
     * 学生ID，外键
     */
    private Integer studentId;

    /**
     * 课程ID，外键
     */
    private Integer courseId;


    /**
     * 成绩分数
     */
    private Integer score;

    /**
     * 考试类型
     */
    private String examType;




    @Override
    public String toString() {
        return "Grades{" +
        "gradeId=" + gradeId +
        ", studentId=" + studentId +
        ", courseId=" + courseId +
        ", score=" + score +
        ", examType=" + examType +
        "}";
    }

    public Grades(GradesTable table) {
        this.studentId = table.getStudentId();
        this.courseId = table.getCourseId();
        this.score = table.getScore();
        this.examType = table.getExamType();
    }
}
